﻿using System;
using System.Net;

namespace LaoLuo.Net
{
    internal class WebClient2 : WebClient
    {
        /// <summary>
        /// Timeout in milliseconds
        /// </summary>
        public int Timeout { get; set; }

        public WebClient2()
        {
            Timeout = 60000;
        }

        public WebClient2(int timeout)
        {
            Timeout = timeout;
        }

        protected override WebRequest GetWebRequest(Uri address)
        {
            var result = base.GetWebRequest(address);
            result.Timeout = Timeout;
            return result;
        }
    }
}
